package cn.iocoder.yudao.module.api.ad.plan.enums;

import cn.iocoder.yudao.framework.business.basic.enums.EnumValuable;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 广告投放计划预期类型
 *
 * @author 山野羡民
 */
@RequiredArgsConstructor
@Getter
public enum AdPlanExceptTypeEnum implements EnumValuable {

    DURATION(0, "固定时长"),
    RANGE(1, "固定时段"),
    ;

    @EnumValue
    private final Integer value;
    private final String name;

    @Override
    public String toString() {
        return new ViewObject(value, name).toString();
    }

    public static AdPlanExceptTypeEnum valueOf(Integer value) {
        for (AdPlanExceptTypeEnum item : values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return DURATION;
    }

}
